package com.example.poemtest.mine;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ImageView;
import android.widget.ListView;

import com.example.poemtest.Activity.BottomNavigationViewActivity;
import com.example.poemtest.R;
import com.example.poemtest.find.bean.CircleBean;
import com.example.poemtest.utils.Constant;
import com.example.poemtest.utils.FullScreenUtil;

import java.util.ArrayList;
import java.util.List;

/**
 * 我发布的词帖
 */
public class MyPostActivity extends AppCompatActivity {

    private ImageView back;
    private ListView listView;
    private MyPostAdapter myPostAdapter;
//    private List<CircleBean.DataBean> list = new ArrayList<>();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        FullScreenUtil.getInstance().fullScreen(this,true);
        setContentView(R.layout.activity_my_post);
        //绑定控件对象
        setView();
        //设置数据
//        setDate();
        myPostAdapter = new MyPostAdapter(
                this,
                Constant.myCreatePostList,
                R.layout.layout_poetry_dynasty_item
        );
        listView.setAdapter(myPostAdapter);
        //点击返回
        back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MyPostActivity.this, BottomNavigationViewActivity.class);
                intent.putExtra("id",4);
                startActivity(intent);
            }
        });
//        listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
//            @Override
//            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
//                Intent intent = new Intent(MyPostActivity.this,BottomNavigationViewActivity.class);
//                intent.putExtra("myPost",list.get(position));
//                startActivity(intent);
//            }
//        });
    }

    /**
     * 设置数据
     */
//    private void setDate() {
//        if (Constant.postList.size() != 0) {
//            for (CircleBean.DataBean dataBean : Constant.postList) {
//                if (dataBean.getUser_name().equals("欲饮一壶酒")) {
//                    list.add(dataBean);
//                }
//            }
//        }
//    }

    /**
     * 绑定控件对象
     */
    private void setView() {
        back = findViewById(R.id.setup_safe_to_mine);
        listView = findViewById(R.id.list_my_post);
    }
}